package com.lq.createPattern.singleton.type8;

public class SingletonTest08 {
    public static void main(String[] args) {
        System.out.println("使用枚举实现单例");
        Singleton instance = Singleton.INSTANCE;
        Singleton instance2 = Singleton.INSTANCE;
        System.out.println(instance2==instance);
        System.out.println(instance2.hashCode());
        System.out.println(instance.hashCode());
    }
}
enum Singleton{
    INSTANCE;
    public void sayOK(){
        System.out.println("hhhahh");
    }
}